﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;

namespace CRM.BLL
{
    [Serializable] 
    public class DictionaryType
    {
        public string Key { get; set; }

        public string Name { get; set; }

        public string Description { get; set; }

        public static List<DictionaryType> GetList()
        {
            List<DictionaryType> list = new List<DictionaryType>();
            DictionaryType entity = null;
            entity = new DictionaryType {Key = "CustomerBase", Name = "CustomerBase", Description = "客户属性"};
            list.Add(entity);
            entity = new DictionaryType { Key = "CustomerType", Name = "CustomerType", Description = "客户类型" };
            list.Add(entity);
            entity = new DictionaryType { Key = "CustomerLevel", Name = "CustomerLevel", Description = "客户等级" };
            list.Add(entity);
            entity = new DictionaryType { Key = "BigCustomerType", Name = "BigCustomerType", Description = "大客户类型" };
            list.Add(entity);
            entity = new DictionaryType { Key = "CustomerStatus", Name = "CustomerStatus", Description = "客户状态" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ProductSatisfaction", Name = "ProductSatisfaction", Description = "产品满意度" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ServiceSatisfaction", Name = "ServiceSatisfaction", Description = "服务满意度" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ConsultingType", Name = "ConsultingType", Description = "咨询类型" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ComplaintType", Name = "ComplaintType", Description = "投诉类型" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ComplaintHandling", Name = "ComplaintHandling", Description = "投诉处理方式" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ComplaintLevel", Name = "ComplaintLevel", Description = "投诉等级" };
            list.Add(entity);
            entity = new DictionaryType { Key = "RepairHandling", Name = "RepairHandling", Description = "故障处理方式" };
            list.Add(entity);
            entity = new DictionaryType { Key = "FailureLevel", Name = "FailureLevel", Description = "故障等级" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ConsultingReminderTime", Name = "ConsultingReminderTime", Description = "咨询待办提醒时间" };
            list.Add(entity);
            entity = new DictionaryType { Key = "RepairReminderTime", Name = "RepairReminderTime", Description = "报修待办提醒时间" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ComplaintReminderTime", Name = "ComplaintReminderTime", Description = "投诉待办提醒时间" };
            list.Add(entity);
            entity = new DictionaryType { Key = "PlaceMethod", Name = "PlaceMethod", Description = "到位方式" };
            list.Add(entity);
            entity = new DictionaryType { Key = "VehicleStatus", Name = "VehicleStatus", Description = "车辆状态" };
            list.Add(entity);
            entity = new DictionaryType { Key = "SalesType", Name = "SalesType", Description = "销售类型" };
            list.Add(entity);
            entity = new DictionaryType { Key = "IsSubsidies", Name = "IsSubsidies", Description = "是否政府补贴" };
            list.Add(entity);
            entity = new DictionaryType { Key = "PurchaseMethod", Name = "PurchaseMethod", Description = "购机方式" };
            list.Add(entity);
            entity = new DictionaryType { Key = "FirstContactType", Name = "FirstContactType", Description = "首选联系方式" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ClaimFormSPType", Name = "ClaimFormSPType", Description = "索赔类型" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ClaimFormServiceCardType", Name = "ClaimFormServiceCardType", Description = "索赔单类型" };
            list.Add(entity);
            entity = new DictionaryType { Key = "IsAllArrive", Name = "IsAllArrive", Description = "旧件处理状态" };
            list.Add(entity);
            entity = new DictionaryType { Key = "RepairType", Name = "RepairType", Description = "报修类型" };
            list.Add(entity);
            entity = new DictionaryType { Key = "RepairMode", Name = "RepairMode", Description = "报修方式" };
            list.Add(entity);
            entity = new DictionaryType { Key = "VisitSituation", Name = "VisitSituation", Description = "回访情况" };
            list.Add(entity);
            entity = new DictionaryType { Key = "NotCloseReason", Name = "NotCloseReason", Description = "未闭环原因" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ServiceReason", Name = "ServiceReason", Description = "服务不满意原因" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ProcuctReason", Name = "ProcuctReason", Description = "产品不满意原因" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ComplaintObjectType", Name = "ComplaintObjectType", Description = "投诉对象类型" };
            list.Add(entity);
            entity = new DictionaryType { Key = "IsCultivate", Name = "IsCultivate", Description = "是否全面培训" };
            list.Add(entity);
            entity = new DictionaryType { Key = "IsTotalChecking", Name = "IsTotalChecking", Description = "是否全面检查" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ClaimFormProductSatisfaction", Name = "ClaimFormProductSatisfaction", Description = "索陪单产品满意度" };
            list.Add(entity);
            entity = new DictionaryType { Key = "ClaimFormServiceSatisfaction", Name = "ClaimFormServiceSatisfaction", Description = "索陪单服务满意度" };
            list.Add(entity);
            entity = new DictionaryType { Key = "CallBackTaskStatus", Name = "CallBackTaskStatus", Description = "联络结果" };
            list.Add(entity);


            entity = new DictionaryType { Key = "IsInitiativeContact", Name = "IsInitiativeContact", Description = "经销商是否主动联系" };
            list.Add(entity);
            entity = new DictionaryType { Key = "IsUnderstandVehicleInfo", Name = "IsUnderstandVehicleInfo", Description = "是否对车辆基本信息了解" };
            list.Add(entity);
            entity = new DictionaryType { Key = "IsHasPurchase", Name = "IsHasPurchase", Description = "是否已购机" };
            list.Add(entity);
            entity = new DictionaryType { Key = "SaleVehicleInfoSource", Name = "SaleVehicleInfoSource", Description = "客户购车信息来源" };
            list.Add(entity);
            entity = new DictionaryType { Key = "CauseAnalysis", Name = "CauseAnalysis", Description = "客户原因分析" };
            list.Add(entity);


            return list;
        }



        /// <summary>
        /// Fills the list control.
        /// </summary>
        /// <param name="listControl">The list control.</param>
        public static void FillListControl(ListControl listControl)
        {
            List<DictionaryType> list = GetList();
            listControl.DataSource = list;
            listControl.DataTextField = "Description";
            listControl.DataValueField = "Name";
            listControl.DataBind();

        }

        /// <summary>
        /// 获取数据字典描述
        /// Gets the name.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public static string GetDescriptionByName(string name)
        {
            DictionaryType entity = GetList().Find(delegate(DictionaryType en)
            {
                if (en.Name.Trim().ToLower() == name.ToLower())
                    return true;
                else
                    return false;
            });
            return (entity == null) ? "" : entity.Description;
        }

        /// <summary>
        /// Gets the name by key.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public static string GetNameByKey(string key)
        {
            DictionaryType entity = GetList().Find(delegate(DictionaryType en)
            {
                if (en.Key.Trim().ToLower() == key.ToLower())
                    return true;
                else
                    return false;
            });
            return (entity == null) ? "" : entity.Name;
        }



    }
}
